<!--监控区数据展示组件-->

<template>
<div class="box" :style="style">
  <div class="label">{{ label }}</div> :
  <div class="data">{{ data }}</div>
</div>
</template>

<script>
export default {
  name: 'Data',
  props: ['label', 'data', 'status'],
  created() {
    if (this.status === 0) {
      this.style.background = '#67C23A';
    } else if (this.status === 1) {
      this.style.background = '#F56C6C';
    } else if (this.status === 2) {
      this.style.background = '#E6A23C';
    } else if (this.status === 3) {
      this.style.background = '#909399';
    }
  },
  data() {
    return {
      style: {
        background: '',
      },
    };
  },
};
</script>

<style scoped lang="scss">
.box {
  font-size: 10px;
  padding-left: 6px;
  padding-right: 6px;
  margin: 0;
  height: 20px;
  text-align: left;
  line-height: 20px;
  display: flex;
  .label{
    margin-right: 2px;
    cursor: pointer;
    -webkit-user-select: none;
    &:hover{
      color: black;
    }
  }
  .data{
    margin-left: 2px;
  }
}
</style>
